package com.zcily.demo.mq;

import com.zcily.demo.config.RabbitConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@Profile({"dev"})
public class RabbitDelayedConsumer {

    @RabbitListener(queues = RabbitConfig.DELAYED_QUEUE)
    public void receiveDelayedQueue(Message message) {
        String msg = new String(message.getBody());
        log.info("收到延时队列的消息：{}", msg);
    }
}
